ol.control.Rorate = function (options) {
    var element = $("<div/>").addClass(options.className);
    var rightBtn = $("<button/>").addClass("right-button"),
        centerBtn = $("<button/>").addClass("center-button"),
        leftBtn = $("<button/>").addClass("left-button");
    element.append(centerBtn);
    element.append(leftBtn);
    element.append(rightBtn);

    var view = options.view;
    var t = Math.PI / 180;

    rightBtn.on("click", function () {
        view.setRotation(90*t);
        centerBtn.css("transform", "rotate(90deg)");
    });
    leftBtn.on("click", function () {
        view.setRotation(-90*t);
        centerBtn.css("transform", "rotate(-90deg)");
    });
    centerBtn.on("click", function () {
        view.setRotation(0);
        centerBtn.css("transform", "rotate(0deg)");
    });

    ol.control.Control.call(this, {
        element: element[0],
        target: null
    });
};
ol.inherits(ol.control.Rorate, ol.control.Control);